
import connect from '@/server/mysql'
export default defineEventHandler(async () => {

  const db = await connect;
  // Create users table
  // await db.execute(`DROP TABLE IF EXISTS users`);
  await db.execute("CREATE TABLE IF NOT EXISTS users ( \`id\` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, \`firstName\` TEXT, \`lastName\` TEXT, \`email\` TEXT)");

  // Add a new user
  await db.execute(`INSERT INTO users VALUES (null, 'John', 'Doe', '')`);

  // Query for users
  const [result] = await db.execute(`SELECT * FROM users limit 4, 2`);

  return result;
});

